/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NewJPanel.java
 *
 * Created on 19/11/2010, 12:21:40 PM
 */

package org.itver.graphics.guitools;

import org.itver.graphics.controller.CameraKeyBehavior;
import org.itver.graphics.controller.TransformGroupManipulator;

/**
 *
 * @author Karo
 */
public class Control extends javax.swing.JPanel {
    TransformGroupManipulator tgm;

    /** Creates new form NewJPanel */
    public Control(TransformGroupManipulator tgm) {
        this.tgm = tgm;
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        stepLeft = new javax.swing.JButton();
        turnRightButton = new javax.swing.JButton();
        goDownButton = new javax.swing.JButton();
        riseUpButton = new javax.swing.JButton();
        turnLeftButton = new javax.swing.JButton();
        stepRight = new javax.swing.JButton();
        stepBackwardButton = new javax.swing.JButton();
        stepForwardButton = new javax.swing.JButton();

        setBackground(new java.awt.Color(255, 255, 255));
        setAlignmentX(0.0010F);
        setAlignmentY(0.0010F);
        setMaximumSize(new java.awt.Dimension(121, 116));
        setMinimumSize(new java.awt.Dimension(121, 116));
        setPreferredSize(new java.awt.Dimension(200, 200));

        jPanel1.setOpaque(false);
        jPanel1.setPreferredSize(new java.awt.Dimension(140, 140));
        jPanel1.setLayout(null);

        stepLeft.setIcon(new javax.swing.ImageIcon("C:\\Users\\Karo\\Desktop\\control\\right2.png")); // NOI18N
        stepLeft.setToolTipText("Dar un paso a la izquierda");
        stepLeft.setContentAreaFilled(false);
        stepLeft.setMargin(new java.awt.Insets(0, 0, 0, 0));
        stepLeft.setRolloverIcon(new javax.swing.ImageIcon("C:\\Users\\Karo\\Desktop\\control\\right2H.png")); // NOI18N
        stepLeft.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stepLeftActionPerformed(evt);
            }
        });
        jPanel1.add(stepLeft);
        stepLeft.setBounds(50, 55, 20, 20);

        turnRightButton.setIcon(new javax.swing.ImageIcon("C:\\Users\\Karo\\Desktop\\control\\left.png")); // NOI18N
        turnRightButton.setToolTipText("Girar hacia la derecha");
        turnRightButton.setBorderPainted(false);
        turnRightButton.setContentAreaFilled(false);
        turnRightButton.setMaximumSize(new java.awt.Dimension(33, 84));
        turnRightButton.setMinimumSize(new java.awt.Dimension(33, 84));
        turnRightButton.setPreferredSize(new java.awt.Dimension(133, 184));
        turnRightButton.setRolloverIcon(new javax.swing.ImageIcon("C:\\Users\\Karo\\Desktop\\control\\leftH.png")); // NOI18N
        turnRightButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                turnRightButtonActionPerformed(evt);
            }
        });
        jPanel1.add(turnRightButton);
        turnRightButton.setBounds(97, 20, 40, 90);

        goDownButton.setIcon(new javax.swing.ImageIcon("C:\\Users\\Karo\\Desktop\\control\\down.png")); // NOI18N
        goDownButton.setToolTipText("Click aquí para bajar");
        goDownButton.setBorderPainted(false);
        goDownButton.setContentAreaFilled(false);
        goDownButton.setPreferredSize(new java.awt.Dimension(83, 34));
        goDownButton.setRolloverIcon(new javax.swing.ImageIcon("C:\\Users\\Karo\\Desktop\\control\\downH.png")); // NOI18N
        goDownButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                goDownButtonActionPerformed(evt);
            }
        });
        jPanel1.add(goDownButton);
        goDownButton.setBounds(29, 89, 90, 40);

        riseUpButton.setIcon(new javax.swing.ImageIcon("C:\\Users\\Karo\\Desktop\\control\\up.png")); // NOI18N
        riseUpButton.setToolTipText("Click aquí para subir");
        riseUpButton.setBorderPainted(false);
        riseUpButton.setContentAreaFilled(false);
        riseUpButton.setPreferredSize(new java.awt.Dimension(83, 34));
        riseUpButton.setRolloverIcon(new javax.swing.ImageIcon("C:\\Users\\Karo\\Desktop\\control\\upH.png")); // NOI18N
        riseUpButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                riseUpButtonActionPerformed(evt);
            }
        });
        jPanel1.add(riseUpButton);
        riseUpButton.setBounds(30, 4, 90, 34);

        turnLeftButton.setIcon(new javax.swing.ImageIcon("C:\\Users\\Karo\\Desktop\\control\\right.png")); // NOI18N
        turnLeftButton.setToolTipText("Girar hacia la izquierda");
        turnLeftButton.setBorderPainted(false);
        turnLeftButton.setContentAreaFilled(false);
        turnLeftButton.setPreferredSize(new java.awt.Dimension(33, 81));
        turnLeftButton.setRolloverIcon(new javax.swing.ImageIcon("C:\\Users\\Karo\\Desktop\\control\\rightH.png")); // NOI18N
        turnLeftButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                turnLeftButtonActionPerformed(evt);
            }
        });
        jPanel1.add(turnLeftButton);
        turnLeftButton.setBounds(12, 20, 40, 90);

        stepRight.setIcon(new javax.swing.ImageIcon("C:\\Users\\Karo\\Desktop\\control\\left2.png")); // NOI18N
        stepRight.setToolTipText("Dar un paso a la derecha");
        stepRight.setContentAreaFilled(false);
        stepRight.setMargin(new java.awt.Insets(0, 0, 0, 0));
        stepRight.setRolloverIcon(new javax.swing.ImageIcon("C:\\Users\\Karo\\Desktop\\control\\left2H.png")); // NOI18N
        stepRight.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stepRightActionPerformed(evt);
            }
        });
        jPanel1.add(stepRight);
        stepRight.setBounds(80, 55, 20, 20);

        stepBackwardButton.setIcon(new javax.swing.ImageIcon("C:\\Users\\Karo\\Desktop\\control\\down2.png")); // NOI18N
        stepBackwardButton.setToolTipText("Dar un paso hacia atrás");
        stepBackwardButton.setContentAreaFilled(false);
        stepBackwardButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
        stepBackwardButton.setRolloverIcon(new javax.swing.ImageIcon("C:\\Users\\Karo\\Desktop\\control\\down2H.png")); // NOI18N
        stepBackwardButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stepBackwardButtonActionPerformed(evt);
            }
        });
        jPanel1.add(stepBackwardButton);
        stepBackwardButton.setBounds(65, 70, 20, 20);

        stepForwardButton.setIcon(new javax.swing.ImageIcon("C:\\Users\\Karo\\Desktop\\control\\up2.png")); // NOI18N
        stepForwardButton.setToolTipText("Dar un paso hacia adelante");
        stepForwardButton.setContentAreaFilled(false);
        stepForwardButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
        stepForwardButton.setRolloverIcon(new javax.swing.ImageIcon("C:\\Users\\Karo\\Desktop\\control\\up2H.png")); // NOI18N
        stepForwardButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stepForwardButtonActionPerformed(evt);
            }
        });
        jPanel1.add(stepForwardButton);
        stepForwardButton.setBounds(65, 40, 20, 17);

        add(jPanel1);
    }// </editor-fold>//GEN-END:initComponents

    private void stepForwardButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stepForwardButtonActionPerformed
        tgm.stepForward();
}//GEN-LAST:event_stepForwardButtonActionPerformed

    private void stepBackwardButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stepBackwardButtonActionPerformed
        tgm.stepBackward();
}//GEN-LAST:event_stepBackwardButtonActionPerformed

    private void stepRightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stepRightActionPerformed
        tgm.stepRightward();
}//GEN-LAST:event_stepRightActionPerformed

    private void turnLeftButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_turnLeftButtonActionPerformed
        tgm.turnLeft();
}//GEN-LAST:event_turnLeftButtonActionPerformed

    private void riseUpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_riseUpButtonActionPerformed
        //        tgm.getTransform();
        tgm.riseUp();
        //        tgm.setTransform();
}//GEN-LAST:event_riseUpButtonActionPerformed

    private void goDownButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_goDownButtonActionPerformed
        tgm.goDown();
}//GEN-LAST:event_goDownButtonActionPerformed

    private void turnRightButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_turnRightButtonActionPerformed
        tgm.turnRight();
}//GEN-LAST:event_turnRightButtonActionPerformed

    private void stepLeftActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stepLeftActionPerformed
        tgm.stepLeftward();
}//GEN-LAST:event_stepLeftActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton goDownButton;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JButton riseUpButton;
    private javax.swing.JButton stepBackwardButton;
    private javax.swing.JButton stepForwardButton;
    private javax.swing.JButton stepLeft;
    private javax.swing.JButton stepRight;
    private javax.swing.JButton turnLeftButton;
    private javax.swing.JButton turnRightButton;
    // End of variables declaration//GEN-END:variables

}
